#include "Auxiliary.h"

BOOL RegisterVmFunction(IN LPVOID lpFunction)
{
    if (g_VmFunctions.Count >= VM_FUNCTION_SIZE) return FALSE;

    g_VmFunctions.Function[g_VmFunctions.Count] = lpFunction;
    g_VmFunctions.Count++;

    return TRUE;
}

void BinCpy64(IN PCHAR dest, IN PCHAR code, IN UINT32 len)
{
    PCHAR pCh = dest;

    RtlCopyMemory(pCh, g_SwitchToX64Code, sizeof(g_SwitchToX64Code));
    pCh += sizeof(g_SwitchToX64Code);
    RtlCopyMemory(pCh, code, len);
    pCh += len;
    RtlCopyMemory(pCh, g_SwitchToX86Code, sizeof(g_SwitchToX86Code));
    pCh += sizeof(g_SwitchToX86Code);
    *pCh = '\xC3';
}
